package com.java.blog.service.impl;

import org.springframework.stereotype.Service;

import com.java.blog.service.CrawlService;
import com.java.blog.webmagic.pipeline.RedisPipeline;
import com.java.blog.webmagic.processor.QsbkRepoPageProcessor;

import us.codecraft.webmagic.Spider;

/**
 * 爬虫接口实现
 *
 */
@Service
public class CrawlServiceImpl implements CrawlService {

	/**
	 * 糗事百科URL
	 */
	private final String QSBK_HOT = "http://www.qiushibaike.com/hot/";

	@Override
	public void startQiushi() {
			Spider.create(new QsbkRepoPageProcessor())
			.addUrl(QSBK_HOT)
			.addPipeline(new RedisPipeline())
			.thread(5)
			.run();
	}

}